<?php
namespace app\product\service;
use app\common\library\Service;

class ProductOrderTrace extends Service
{
    use \app\common\library\traits\Model;
    protected $model = 'product/product_order_trace';

	protected function _initialize()
    {
        parent::_initialize();
        $this->model = model('product/product_order_trace');
    }

    /**
     * 创建贷款订单日志
     * @param string $sn
     * @param integer $uid
     * @param string $content
     * @return mixed
     */
    public function create($sn, $uid, $content) {
        $info = [
            'order_sn' => $sn,
            'action_uid' => $uid,
            'content' => '',
        ];
        \think\Lang::load(APP_PATH . 'product/lang/zh-cn/product_order_trace.php');
        $lang = \think\Lang::get('product_order_trace');
        $vars = explode(".", $content);
        foreach ($vars as $var) {
            $lang = $lang[$var];
        }
        $info['content'] = $lang;
        $result = $this->save($info, []);
        if(!$result) {
            $this->error = $this->getError();
            return false;
        }
        return $info;
    }

}